<?php

namespace app\speedDating\exception;

use app\speedDating\interfaces\ServiceCode;

class ServiceRuntimeException extends \RuntimeException
{
    protected $error;
    protected $state;

    public function __construct($error,$state = ServiceCode::ERR_SERVER_ERROR)
    {
        $this->error   = $error;
        $this->message = is_array($error) ? implode(PHP_EOL, $error) : $error;
        $this->state   = $state;
    }

    /**
     * 获取验证错误信息
     * @access public
     * @return array|string
     */
    public function getError()
    {
        return $this->error;
    }

    /**
     * 获取验证错误信息
     * @access public
     * @return array|string
     */
    public function getState()
    {
        return $this->state;
    }
}